package com.ming.tank;

import java.awt.*;

/**
 * @ClassName Explode
 * @Description 爆炸类
 * @Author H.M
 * @Date 2021/6/20
 * @Version 1.0
 **/
public class Explode {
    private static final int SPEED = 10;
    public static final int WIDTH = ResourceMgr.bulletD.getWidth();
    public static final int HEIGHT = ResourceMgr.bulletD.getHeight();
    private int x, y;
    private boolean living = true;
    TankFrame tankFrame = null;
    private int step = 0;


    public Explode(int x, int y ,TankFrame tf) {
        this.x = x;
        this.y = y;
        this.tankFrame = tf;
        new Thread(()->new Audio("audio/explode.wav").play()).start();
    }

    public void paint(Graphics g) {
      g.drawImage(ResourceMgr.explodes[step++],x,y,null);
      if (step >= ResourceMgr.explodes.length) {
          tankFrame.explodes.remove(this);
      }
    }

}
